<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <button>change</button>
  <script>
    let token = '123'
    localStorage.setItem('token', token)
    document.querySelector('button').addEventListener('click',()=>{
      token = '456'
      localStorage.setItem('token', token)
    })

    // vuex中的数据是响应式的, 不是持久化的 , 一刷新页面 vuex中的数据会丢失状态
    // localStorage 数据是持久化的
  </script>
</body>
</html>